package com.apes.fn.server.productRequire;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.product.model.Product;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = RequireLogistics.CONST_TABLE_NAME)
public class RequireLogistics extends Model {
    public static final String CONST_TABLE_NAME = "stock_require_logistics";

    @Id
    @Column(name = "id")
    @ApesGenerator(code = CONST_TABLE_NAME, name = "要货物流跟踪")
    private String id;

//    @Column(name = "current_id", length = 100)
//    @Comment("当前单据编码")
//    private String cuuentId;

    @Column(name = "source", length = 100)
    @Comment("上游单据号码")
    private String source;

    @Column(name = "source_type", length = 64)
    @Comment("上游单据类型")
    private String sourceType;

    @Column(name = "origin", length = 30)
    @Comment("原始单据")
    private String origin;

    @Column(name = "origin_business_type", length = 32)
    @Comment("源单据类型")
    private String originBusinessType;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "product_id", referencedColumnName = "id")
    @Comment("商品")
    private Product product;

//    @ManyToOne(fetch = FetchType.LAZY)
//    @JoinColumn(name = "product_uom_id", referencedColumnName = "id", nullable = false)
//    @Comment("计量单位")
//    private ProductUom uom;

    @Column(name = "message", length = 3000)
    @Comment("消息")
    private String message;



}
